package com.design;

/**
 * 测试类
 */
public class MainTest {
    public static void main(String[] args) throws InterruptedException {
        OnlineDocument onlineDocument = new OnlineDocument("设计模式");
        HistoryManager historyManager = new HistoryManager();
        onlineDocument.setContent("1. 单例模式");
        historyManager.addHistory(onlineDocument.createMemento());
        Thread.sleep(2000);
        onlineDocument.setContent("2. 工厂模式");
        historyManager.addHistory(onlineDocument.createMemento());
        historyManager.historyList();
        onlineDocument.restoreMemento(historyManager.getHistory(0));
    }
}
